// ignore_for_file: deprecated_member_use

import 'package:flutter/material.dart';
import 'package:getx/custom/customappbar.dart';
import 'package:get/get.dart';
import 'package:getx/getx/count_getx.dart';

// ignore: must_be_immutable
class OtherPage extends StatelessWidget {
  final Controller other = Get.find();
  String name;
  OtherPage({Key? key, required this.name}) : super(key: key);
  @override
  Widget build(context) {
    return Scaffold(
      appBar: CustomAppbar(name, Theme.of(context).primaryColor),
      body: Center(
        child: CircleAvatar(
          backgroundColor: Theme.of(context).primaryColor,
          child: Text(
            "${other.count}",
            style: const TextStyle(fontSize: 10.0),
          ),
          foregroundColor: Colors.white,
        ),
      ),
    );
  }
}

// ignore: must_be_immutable
class NextScreen extends StatelessWidget {
  String name;
  NextScreen({Key? key, required this.name}) : super(key: key);
  @override
  Widget build(context) {
    return Scaffold(
      appBar: CustomAppbar(name, Theme.of(context).primaryColor),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children:  [
            Text(
              name,
              style: const TextStyle(fontSize: 10.0),
            )
          ],
        ),
      ),
    );
  }
}



// ignore: must_be_immutable
class BackScreen extends StatelessWidget {
  String name;
  BackScreen({Key? key, required this.name}) : super(key: key);
  @override
  Widget build(context) {
    return Scaffold(
      appBar: CustomAppbar(name, Theme.of(context).primaryColor),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            RaisedButton(
              onPressed: () {
                // Get.back();
                // 对应原生路由：
                // Navigator.pop(context);

                // 带返回值返回前一个路由
                Get.back(result: 'success');

                // 对应原生路由：
                // Navigator.pop(context, 'success');

              },
              child: const Text('返回'),
            )
          ],
        ),
      ),
    );
  }
}

// ignore: must_be_immutable
class OffScreen extends StatelessWidget {
  String name;
  OffScreen({Key? key, required this.name}) : super(key: key);
  @override
  Widget build(context) {
    return Scaffold(
      appBar: CustomAppbar(name, Theme.of(context).primaryColor),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children:  [
            Text(
              name,
              style: const TextStyle(fontSize: 10.0),
            )
          ],
        ),
      ),
    );
  }
}

// ignore: must_be_immutable
class OffAllScreen extends StatelessWidget {
  String name;
  OffAllScreen({Key? key, required this.name}) : super(key: key);
  @override
  Widget build(context) {
    return Scaffold(
      appBar: CustomAppbar(name, Theme.of(context).primaryColor),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children:  [
            Text(
              name,
              style: const TextStyle(fontSize: 10.0),
            )
          ],
        ),
      ),
    );
  }
}

